import { _decorator, Component, Label, Node, Sprite } from 'cc';
import { BallSkinInfo } from '../../Data/GlobaInterface';
const { ccclass, property } = _decorator;

@ccclass('PopSingleBallSkin')
/**
 * 顶部单个球皮肤
 */
export class PopSingleBallSkin extends Component {

    //球
    @property(Sprite)
    private Ball: Sprite = null;

    //价格文字
    @property(Label)
    private PriceLabel: Label = null;

    //皮肤信息
    public Info: BallSkinInfo = null;

    //已解锁文字
    @property(Node)
    private UnLockLabel: Node = null;

    //对号
    @property(Node)
    public RightIcon: Node = null;

    /**
     * 更新球得信息
     */
    public UpdateBallInfo(_info: BallSkinInfo) {
        this.Info = _info;
        this.Ball.spriteFrame = app.resManager.SpriteFrames["game_normalball" + (_info.Index + 1)];
        this.PriceLabel.string = _info.Price.toString();
        this.UnLockLabel.active = false;

        if (this.Info.IsBuy) {
            this.UnLockLabel.active = true;
            this.PriceLabel.node.active = false;
        }

        this.RightIcon.active = false;
    }

}


